import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Main',
    component: () => import('../views/Main.vue'),

    //二级路由
    children: [
      {
        path: 'home',
        //别名
        alias: '',
        name: 'Home',
        component: () => import('../views/Home.vue'),
      },
      {
        path: 'shopbag',
        name: 'Shopbag',
        component: () => import('../views/Shopbag.vue'),
      },
      {
        path: 'my',
        name: 'My',
        component: () => import('../views/My.vue'),
      },
      {
        path: 'menuPlus',
        name: 'MenuPlus',
        component: () => import('../views/MenuPlus.vue'),
      }
    ]
  },
  {
    path: '/closeAccount',
    name: 'CloseAccount',
    component: () => import('../views/CloseAccount.vue'),
  },
  {
    path: '/site',
    name: 'Site',
    component: () => import('../views/Site.vue'),
  },
  {
    path: '/detail/:pid',
    name: 'Detail',
    component: () => import('../views/Detail.vue'),
  },
  {
    path: '/edit',
    name: 'Edit',
    component: () => import('../views/Edit.vue'),
  },
  {
    path: '/personalData',
    name: 'PersonalData',
    component: () => import('../views/PersonalData.vue'),
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue'),
  },
  {
    path: '/myOrder',
    name: 'MyOrder',
    component: () => import('../views/MyOrder.vue')
  },
  {
    path: '/myCollect',
    name: 'MyCollect',
    component: () => import('../views/MyCollect.vue')
  },
  {
    path: '/safety',
    name: 'Safety',
    component: () => import('../views/Safety.vue')
  },
  {
    path: '/search',
    name: 'Search',
    component: () => import('../views/Search.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register.vue'),
  }
]

const router = new VueRouter({
  routes
})

export default router
